<?php

/**
 * Evenement form base class.
 *
 * @method Evenement getObject() Returns the current form's model object
 *
 * @package    tfe
 * @subpackage form
 * @author     3emeIG
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseEvenementForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'libelle'          => new sfWidgetFormInputText(),
      'date'             => new sfWidgetFormDate(),
      'heure_de_debut'   => new sfWidgetFormTime(),
      'heure_de_fin'     => new sfWidgetFormTime(),
      'prix_reservation' => new sfWidgetFormInputText(),
      'prix_sur_place'   => new sfWidgetFormInputText(),
      'prix_jeunes'      => new sfWidgetFormInputText(),
      'prix_membres'     => new sfWidgetFormInputText(),
      'lieu'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lieu'), 'add_empty' => false)),
      'commentaire'      => new sfWidgetFormTextarea(),
      'type'             => new sfWidgetFormInputText(),
      'id_spectacle'     => new sfWidgetFormInputText(),
      'id_atelier'       => new sfWidgetFormInputText(),
      'id_stage'         => new sfWidgetFormInputText(),
      'id_location'      => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'libelle'          => new sfValidatorString(array('max_length' => 45)),
      'date'             => new sfValidatorDate(),
      'heure_de_debut'   => new sfValidatorTime(),
      'heure_de_fin'     => new sfValidatorTime(),
      'prix_reservation' => new sfValidatorNumber(array('required' => false)),
      'prix_sur_place'   => new sfValidatorNumber(array('required' => false)),
      'prix_jeunes'      => new sfValidatorNumber(array('required' => false)),
      'prix_membres'     => new sfValidatorNumber(array('required' => false)),
      'lieu'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Lieu'))),
      'commentaire'      => new sfValidatorString(array('required' => false)),
      'type'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'id_spectacle'     => new sfValidatorInteger(array('required' => false)),
      'id_atelier'       => new sfValidatorInteger(array('required' => false)),
      'id_stage'         => new sfValidatorInteger(array('required' => false)),
      'id_location'      => new sfValidatorInteger(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('evenement[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Evenement';
  }

}
